<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<script>
    $(function () {
        $.ajax({
            type: 'get',
            url: '/get_prov',
            success: function (res) {
                var html = ""
                $.each(res.data, function (i, item) {
                    var id = item[0]
                    var title = item[1]
                    html += "<option value='" + id + "'>" + title + "</option>"
                })
                $("#prov").html(html)
            }
        })
        $("#prov").on("change", function () {
            var id = $(this).val()
            $.ajax({
                type: 'get',
                url: '/child_city?id=' + id,
                success: function (res) {
                    var html = ""
                    $.each(res.data, function (i, item) {
                        var id = item[0]
                        var title = item[1]
                        html += "<option value='" + id + "'>" + title + "</option>"
                    })
                    $("#city").html(html)
                    $("#county").html("<option>请选择县</option>")
                }
            })
        })
        $("#city").on("change", function () {
            var id = $(this).val()
            $.ajax({
                type: 'get',
                url: '/child_city?id=' + id,
                success: function (res) {
                    var html = ""
                    $.each(res.data, function (i, item) {
                        var id = item[0]
                        var title = item[1]
                        html += "<option value='" + id + "'>" + title + "</option>"
                    })
                    $("#county").html(html)
                }
            })
        })
    })
</script>

<body>
    <select id="prov">
        <option>请选择省</option>
    </select>
    <select id="city">
        <option>请选择市</option>
    </select>
    <select id="county">
        <option>请选择县</option>
    </select>
</body>

</html>